{include file="top.html"} 
<script type="text/javascript">
$(function(){
    $('#register_form').validate({
        errorPlacement: function(error, element){
            var error_td = element.parent('dd');
			error_td.find('i').removeClass('ok');
            error_td.find('label').hide();
            error_td.append(error);
        },
        success       : function(label){
			label.siblings('i').addClass('ok');
            label.remove();
        },
        onkeyup: false,
        rules : {
            user_name : {
                required : true,
                byteRange: [3,15,'{$charset}'],
                remote   : {
                    url :'index.php?app=member&act=check_user&ajax=1',
                    type:'get',
                    data:{
                        user_name : function(){
                            return $('#user_name').val();
                        }
                    }
                }
            },
            password : {
                required : true,
                minlength: 6
            },
            password_confirm : {
                required : true,
                equalTo  : '#password'
            },
            email : {
                required : true,
                email    : true,
				remote   : {
                    url :'index.php?app=member&act=check_email_info&ajax=1',
                    type:'get',
                    data:{
                        email : function(){
                            return $('#email').val();
                        }
                    }
                }
            },
			phone_mob : {
                required : true,
				number : true,
                minlength: 11,
				maxlength: 11,
				remote   : {
                    url :'index.php?app=member&act=check_phone_mob&ajax=1',
                    type:'get',
                    data:{
                        phone_mob : function(){
                            return $('#phone_mob').val();
                        }
                    }
                }
            },
			check_code:{
				required : true	
			},
            captcha : {
                required : true,
                remote   : {
                    url : 'index.php?app=captcha&act=check_captcha',
                    type: 'get',
                    data:{
                        captcha : function(){
                            return $('#captcha1').val();
                        }
                    }
                }
            },
            agree : {
                required : true
            }
        },
        messages : {
            user_name : {
                required : '{$lang.user_name_required}',
                byteRange: '{$lang.user_name_limit}',
                remote   : '{$lang.user_already_taken}'
            },
            password  : {
                required : '{$lang.password_required}',
                minlength: '{$lang.password_length_limit}'
            },
            password_confirm : {
                required : '{$lang.password_confirm_please}',
                equalTo  : '{$lang.password_inconsistent}'
            },
            email : {
                required : '{$lang.email_required}',
                email    : '{$lang.email_invalid}',
				remote   : '{$lang.email_exist}'
            },
			phone_mob : {
				required : '{$lang.phone_mob_required}',
				number : '{$lang.err_number_only}',
                minlength: '{$lang.err_phone_mob_desc}',
				maxlength: '{$lang.err_phone_mob_desc}',
				remote   : '{$lang.phone_mob_exist}'
            },
			<!--{if $phone_captcha}-->
			check_code : {
				required : '{$lang.check_code_required}',
			},
			<!--{/if}-->
            captcha : {
                required : '{$lang.captcha_required}',
                remote   : '{$lang.captcha_error}'
            },
            agree : {
                required : '{$lang.agree_required}'
            }
        }
    });

	poshytip_message($('#user_name'));
	poshytip_message($('#password'));
	poshytip_message($('#password_confirm'));	
	poshytip_message($('#email'));
	poshytip_message($('#phone_mob'));
	poshytip_message($('#captcha1'));

	$('#send_phonecode').click(function(){
		var phone_mob = $.trim($("input[name='phone_mob']").val());
		if(phone_mob=='' || !is_mobile(phone_mob)){
			alert("{$lang.phone_mob_invalid}");
			return;
		}
		send_phonecode($(this), {from: "register", phone_mob: phone_mob}, 120);
	});
});
</script>
<style>
.w{width:990px;}
</style>
<div id="main" class="w-full">
	<div id="page-register" class="w-full page-auth mt20 mb20">
		<div class="wrap">
			<div class="w logo mb10">
				<p><a href="{$site_url}" title="{$site_title}"><img alt="{$site_title}" src="{$site_logo}" /></a></p>
			</div>
			<div class="form w clearfix">
				<form id="register_form" method="post">
					<dl class="clearfix">
						<dt><b>*</b>{$lang.user_name} :</dt>
						<dd>
							<input type="text" id="user_name" class="input"  name="user_name" title="{$lang.register_user_name_tip}"  />
							<i class="i-name"></i> </dd>
					</dl>
					<dl class="clearfix">
						<dt><b>*</b>{$lang.password} :</dt>
						<dd>
							<input class="input" type="password" id="password" name="password" title="{$lang.register_password_tip}" />
							<i class="i-psw"></i> </dd>
					</dl>
					<dl class="clearfix">
						<dt><b>*</b>{$lang.password_confirm} :</dt>
						<dd>
							<input class="input" type="password" id="password_confirm" name="password_confirm" title="{$lang.register_password_confirm_tip}" />
							<i class="i-psw"></i> </dd>
					</dl>
					<dl class="clearfix">
						<dt><b>*</b>{$lang.email} :</dt>
						<dd>
							<input class="input" type="text" id="email" name="email" title="{$lang.register_email_tip}" />
							<i class="i-email"></i> </dd>
					</dl>
					<dl class="clearfix">
						<dt><b>*</b>{$lang.phone_mob} :</dt>
						<dd>
							<input type="text" name="phone_mob" id="phone_mob" class="input" title="{$lang.register_phone_mob_tip}" />
							<i class="i-phone"></i> </dd>
					</dl>
					<!--{if $phone_captcha}-->
					<dl class="clearfix">
						<dt><b>*</b>{$lang.phone_captcha} :</dt>
						<dd class="captchaCode clearfix">
							<input type="text" name="check_code" id="check_code" class="input float-left" />
							<input type="button" id="send_phonecode" class="float-left btn-captcha" value="{$lang.get_captcha}" />
						</dd>
					</dl>
					<!--{/if}--> 
					
					<!--{if $captcha}-->
					<dl class="clearfix">
						<dt><b>*</b>{$lang.captcha} :</dt>
						<dd class="captcha clearfix">
							<input type="text" class="input float-left" name="captcha" id="captcha1" title="{$lang.register_captcha_tip}" />
							<a href="javascript:change_captcha($('#captcha'));" class="float-left mt5" style="margin-right:42px;"><img height="26" id="captcha" src="index.php?app=captcha&amp;{$random_number}" /></a> </dd>
					</dl>
					<!--{/if}-->
					<dl class="clearfix">
						<dt>&nbsp;</dt>
						<dd class="mall-eula">
							<input id="clause" type="checkbox" name="agree" value="1" class="agree-checkbox" checked="checked" />
							<span style="margin-right:85px;">{$lang.i_have_read} <a href="{url app=article&act=system&code=eula}" target="_blank">{$lang.mall_eula}</a></span> </dd>
					</dl>
					<dl class="clearfix">
						<dt>&nbsp;</dt>
						<dd>
							<input type="submit" name="Submit" value="{$lang.register_now}" class="register-submit" title="{$lang.register_now}" />
							<input type="hidden" name="ret_url" value="{$ret_url}" />
						</dd>
					</dl>
				</form>
			</div>
		</div>
	</div>
</div>
{include file="footer.html"} 